package com.chenglong.supermarket.chenglongsearch.controller;

import com.chenglong.supermarket.chenglongsearch.service.ProductSaveService;
import com.chenglong.supermarket.common.to.es.SkuEsModel;
import com.chenglong.supermarket.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * @program: cheng-long-mall
 * @description:
 * @author: JIANGBEI
 * @create: 2021-05-10 20:40
 **/
@RestController
@RequestMapping("/search")
public class ElasticSearchController {

    @Autowired
    ProductSaveService productSaveService;
    @PostMapping("/productup")
    public R productStatusUp(List<SkuEsModel> skuEsModelList){
        try {
            productSaveService.productStatusUp(skuEsModelList);
            return R.ok();
        } catch (IOException e) {
            return R.error().put("message","商品上架异常");
        }
    }
}
